tools/oxenstored: Render backtraces more nicely in Syslog
authorAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 1 Dec 2022 21:06:25 +0000 (21:06 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 20 Dec 2022 13:13:40 +0000 (13:13 +0000)
commitc4972a4272690384b15d5706f2a833aed636895e
tree5dead60055c879bd6c3b3d8962949f58bb973337
parent91a9ac6e9be5aa94020f5c482e6c51b581e2ea39
tools/oxenstored: Render backtraces more nicely in Syslog

fallback_exception_handler feeds a string with embedded newlines directly into
syslog().  While this is an improvement on getting nothing, syslogd escapes
all control characters it gets, and emits one (long) log line.

Fix the problem generally in the syslog stub.  As we already have a local copy
of the string, split it in place and emit one syslog() call per line.

Also tweak Logging.msg_of to avoid putting an extra newline on a string which
already ends with one.

Fixes: ee7815f49faf ("tools/oxenstored: Set uncaught exception handler")
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
(cherry picked from commit d2162d884cba0ff7b2ac0d832f4e044444bda2e1)
tools/ocaml/xenstored/logging.ml
tools/ocaml/xenstored/syslog_stubs.c